package cn.app

import java.io.{File, FileWriter}

import scala.io.{BufferedSource, Source}

/**
  * Created by lzd on 2018/11/22.
  */
object FileDemo {
  def main(args: Array[String]): Unit = {
    read()
  }

  def read() = {
    val file: BufferedSource = Source.fromFile("D:\\1688\\158.txt")
    val lines: Iterator[String] = file.getLines()
    for (line <- lines) {
      println(line)
    }
    file.close()
  }

  def write(): Unit = {

    val writer = new FileWriter(new File(""), true)
    writer.write("")
    writer.flush()
    writer.close()
  }
}
